# Create the category pages seen in the categories.txt file
#
#foreach $en (sort keys %ENV) {
#print "$en = $ENV{$en}\n";
#}
$CATS = "false";
$APPLETS = "false";
$COMP = "false";
$CHECK = "false";
$REPORT = "false";
$HTML_FORMAT = "false";
$PROD = "false";
$SOFT = "false";
$PLATFORM = "sparc";
$DIR_IMAGES = "../CDware/images/";
$PRODUCTS_DIR = "../";
# parse command line arguements
#print "Arg=@ARGV.\n";
@ARGREPORT = @ARGV;
if (@ARGV == 0) {
@ARGV=("-?");
}
while ($ARGV[0] =~ /^-/) {
$_ = shift;
#print "Arg=$_.\n";
if (/^-cats$/) {
$CATS = "true";
} elsif (/^-applets/) {
$APPLETS = "true";
} elsif (/^-comp/) {
$COMP = "true";
} elsif (/^-checkall/) {
$CHECK = "true";
$CHECKLINKS = "true";
} elsif (/^-checklinks/) {
$CHECKLINKS = "true";
} elsif (/^-check/) {
$CHECK = "true";
} elsif (/^-soft/) {
$SOFT = "true";
} elsif (/^-report/) {
$REPORT = "true";
} elsif (/^-html/) {
$HTML_FORMAT = "true";
} elsif (/^-names/) {
$NAMES = "true";
} elsif (/^-dir/) {
$PRODUCTS_DIR = ($1 ? $1 : shift);
unless (-s $PRODUCTS_DIR) {
die "ERROR: $PRODUCTS_DIR is not a directory\n";
}
} elsif (/^-prod/) {
$PROD = "true";
} elsif (/^-all/) {
$PROD = "true" ;
$COMP = "true";
$SOFT = "true";
$APPLETS = "true";
$CATS = "true";
$NAMES = "true";
} elsif (/^-x86/) {
$PLATFORM = x86;
$SRC_DIR = "../../../x86.image";
} elsif (/^-[?Hh]/) {
die "Usage: update.pl [ -cats | -applets | -soft | -prod | -all | -dir dirname | -x86 | -report | -html | -names | -check]\n\tall: = -cats -prod -applets\n\tapplets: creates an applet in the customer home page.\n\tcats: creates the category and company pages.\n\tcheck: check the _info file, and other things for errors.\n\tdir: gives the directory where the companies are located.\n\thtml: when -report is selected, creates an output in HTML format.\n\tnames: create list of company names keyed on directory name.\n\tprod: creates the product page.\n\treport: creates a report for all companies.\n\tsoft: creates the Software pages\n\tx86: for future usage.\n";
} else {
die "Unrecognized switch: $_ (try -?)\n";
}
}
&PrintHtml("<HTML> <HEAD> <title>Catalyst CDware - status on " . `date` . "</title> </HEAD> <BODY bgcolor=\"#DDDDDD\"><H1>", "Catalyst CDware - status on " . `date` . "\n", "</H1>");
# check if root user
if ( $ENV{"USER"} ne "root" ) {
&PrintHtml("", "WARNING: This program should be run as root user.\n", "<BR>");
}
if ($REPORT ne "true") {
$HostName = `hostname`;
chop $HostName;
&PrintHtml("", "\nUpdating CDware on $HostName:\n\n", "<BR>");
if (open (REPORTFILE, ">> $PRODUCTS_DIR/.update.txt")) {
$Date = `date`;
chop $Date;
print REPORTFILE "update by " . $ENV{"USER"} . " on $Date from $HostName\n\tparams: ";
while (@ARGREPORT) {
print REPORTFILE "$ARGREPORT[0], ";
shift @ARGREPORT;
}
print REPORTFILE "\n\n";
close (REPORTFILE);
} else {
&PrintHtml("", "WARNING: Cannot open $PRODUCTS_DIR/.update.txt\n", "<BR>");
}
}
&InitCompInfo();
$CAT_DIR = "$PRODUCTS_DIR/.categories";
$FRAMEBASICNAME = "CDware.frame.html";
$HEADBASICNAME = "CDware.head.html";
#print $CAT_DIR;
if ( ! -d $CAT_DIR ) {
mkdir($CAT_DIR, 0777);
}
if ( $CHECK eq "true" ) {
&CheckFiles();
}
if ( $NAMES eq "true" ) {
&CreateNames();
}
if ( $CHECKLINKS eq "true" ) {
&CheckLinks();
}
if ( $CATS eq "true" ) {
&CreateCat();
}
if ( $SOFT eq "true" ) {
&CreateSoft();
}
#
# Get all CDware menu bar components and put in file
# for building of front page applet
#
if ( $APPLETS eq "true" ) {
&CreateApplet();
}
if ( $PROD eq "true" ) {
&CreateProduct();
}
if ( $REPORT eq "true" ) {
&CreateReport();
}
#
# Compile list of companies, place in 'companies' file
#
#if ( $COMP eq "true" ) {
#&CreateComp();
#}
#
# Compile list of products, place in 'products' file
#
#print "\n\n\nPress <RETURN> to close the window and test your submission..\n.";